Harden vscode/cursor install-hooks when IDE CLI is not in PATH#475
Merged
Harden vscode/cursor install-hooks when IDE CLI is not in PATH#475
Conversation
|
No AI authorship found for these commits. Please install git-ai to start tracking AI generated code in your commits. |
… not in PATH Add EditorCliCommand struct and resolve_editor_cli() function that first checks if the editor CLI (code/cursor) is in PATH, and falls back to finding the Electron binary and cli.js directly in known installation directories. This mimics what the shell script wrappers do. Update is_vsc_editor_extension_installed(), install_vsc_editor_extension(), and version checking in both cursor.rs and vscode.rs to use the new resolution mechanism. Co-authored-by: svarlamov <10859025+svarlamov@users.noreply.github.com>
|
|
Co-authored-by: svarlamov <10859025+svarlamov@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Harden vscode/cursor install-hooks for missing CLI
Harden vscode/cursor install-hooks when IDE CLI is not in PATH
Feb 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
code/cursorCLIs aren't inPATH, extension installation silently fails with a warning. The CLIs are just shell script wrappers over Electron'scli.js— we can call it directly as a fallback.Changes
EditorCliCommandstruct (utils.rs) — Encapsulates CLI invocation, handling both PATH binaries and the Electron +cli.jsfallback (setsELECTRON_RUN_AS_NODE=1, passescli.jsas first arg, handles Windowscmd /Cwrapping)resolve_editor_cli(name)— Checks PATH first, then searches known OS-specific install locations:/Applications/{Cursor,Visual Studio Code}.app/Contents/.../usr/share/,/opt/,~/.local/share/%LOCALAPPDATA%\Programs\...is_vsc_editor_extension_installed/install_vsc_editor_extension— Now accept&EditorCliCommandinstead of&str, using itscommand()buildercursor.rs/vscode.rs— Replacedbinary_exists()+ raw program name withresolve_editor_cli()in bothcheck_hooks()andinstall_extras()How the fallback works
The
code/cursorshell scripts essentially do:resolve_editor_clifinds these paths directly when the wrapper script isn't inPATH, constructs the equivalent command, and uses it for version checks, extension listing, and extension installation.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.